/*******************************************************************************
 * Copyright (c) 2006 CEA LIST.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     CEA LIST - initial API and implementation
 *******************************************************************************/
package com.cea.papyrus.activitydiagram.tabbedproperties.section;

import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.CreateObjectAction;
import org.eclipse.uml2.uml.NamedElement;

import com.cea.papyrus.core.tabbedproperties.AbstractSelectionElementSection;


/**
 * this section is to display the value Classifier of a CreateObjectAction
 * @author Patrick Tessier
 * 
 */
public class CreateObjectActionClassifierSection extends AbstractSelectionElementSection{


	public CreateObjectActionClassifierSection() {
		super("Classifier:", new com.cea.papyrus.core.filters.ClassifierFilter() );
		// TODO Auto-generated constructor stub
	}
	/**
	 * {@inheritDoc}
	 */
	public NamedElement getReferencedElementToDisplay() {
		return ((CreateObjectAction)getElement()).getClassifier();
	}
	/**
	 * {@inheritDoc}
	 */
	@Override
	public void removeReferencedElement() {
		if( getElement() instanceof CreateObjectAction){
			((CreateObjectAction)getElement()).setClassifier(null);}
	}
	/**
	 * {@inheritDoc}
	 */
	@Override
	public void setReferencedElement(NamedElement element) {
		if (element instanceof Classifier){
			Classifier aClassifier = (Classifier)element; 
			if(aClassifier!= null){
				((CreateObjectAction)getElement()).setClassifier(aClassifier);}
		}
	}



}